package com.mydemo.admin.service.impl;

import com.mydemo.admin.mapper.SysOperLogMapper;
import com.mydemo.admin.service.ISysOperLogService;
import com.mydemo.common.pojo.SysOperLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Last_Island
 * @version 1.0
 */
@Service
public class SysOperLogService implements ISysOperLogService {
    @Autowired
    private SysOperLogMapper sysOperLogMapper;

    /**
     * 查询操作日志列表
     *
     * @param log 查询条件
     * @return
     */
    @Override
    public List<SysOperLog> getList(SysOperLog log) {
        return sysOperLogMapper.getList(log);
    }

    /**
     * 根据id查询一条日志记录
     *
     * @param id
     * @return
     */
    @Override
    public SysOperLog getOperLogById(Long id) {
        return sysOperLogMapper.getOperLogById(id);
    }

    /**
     * 新增一条日志记录
     *
     * @param log
     * @return
     */
    @Override
    public boolean insert(SysOperLog log) {
        return sysOperLogMapper.insert(log) > 0;
    }

    /**
     * 批量删除日志记录
     *
     * @param ids
     * @return
     */
    @Transactional
    @Override
    public boolean delete(Long[] ids) {
        return sysOperLogMapper.delete(ids) == ids.length;
    }
}
